package com.authine.cloudpivot.web.api.secondopen.controller;

import com.authine.cloudpivot.web.api.secondopen.utils.BarCodeUtil;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Base64;

/**
 * 单号转条形码
 */
@Api(value = "二开接口",tags = "生成条形码")
@RestController
@RequestMapping("/api/barcode")
public class BarcodeController {

    /**
     * 获取条形码----base64
     * @param msg
     * @return
     */
    @GetMapping("/getBarcode")
    public String getBarcode(String  msg){
        byte[] photoBytes =BarCodeUtil.generateBarCode128(msg, 100.0, 10.0, true, true);
        return Base64.getEncoder().encodeToString(photoBytes);
    }
}
